package Conf

import (
	"deploy/schema"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

func GetConf(conf ,unitId string)([]schema.ConfigDataEntity,error){
	url :=fmt.Sprintf("%s?unitId=%s",conf,unitId)
	resp,err :=http.Get(url)
	if err!=nil{
		return nil,err
	}
	body, err := ioutil.ReadAll(resp.Body)
	if err !=nil {
		return nil,err
	}
	var a schema.SchemaGetConfResult
	err = json.Unmarshal(body,&a)
	if err != nil{
		return nil,err
	}
	return a.ConfigDataEntityList,nil
}
